#define _CRT_SECURE_NO_WARNINGS 1

class Solution {
public:
    vector<vector<int>> ans;
    vector<int> path;

    void fun(int n, int k, int startIndex) {
        if (path.size() == k) {
            ans.push_back(path);
            return;
        }

        for (int i = startIndex; i < n; i++) {
            path.push_back(i + 1);
            fun(n, k, i + 1);
            path.pop_back();
        }
        return;
    }

    vector<vector<int>> combine(int n, int k) {
        fun(n, k, 0);
        return ans;
    }
};